using JRO;
using System;
using System.Collections;
using System.Data.OleDb;
using System.IO;
internal class EventClickUtil
{
	public OleDbConnection oleDbConnection_0;
	public string string_0;
	public EventClickUtil()
	{
		this.string_0 = Directory.GetCurrentDirectory();
		this.method_0();
	}
	public EventClickUtil(string string_1)
	{
		this.string_0 = Directory.GetCurrentDirectory();
		this.method_1(string_1);
	}
	public void method_0()
	{
		if (this.oleDbConnection_0 == null)
		{
			string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=" + this.string_0 + "\\config\\鹊桥数据副.mdb;Jet OLEDB:Database Password=item[%]789";
			this.oleDbConnection_0 = new OleDbConnection(connectionString);
			this.oleDbConnection_0.Open();
		}
	}
	public void method_1(string string_1)
	{
		if (this.oleDbConnection_0 == null)
		{
			string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=" + string_1;
			this.oleDbConnection_0 = new OleDbConnection(connectionString);
			this.oleDbConnection_0.Open();
		}
	}
	public void method_10()
	{
		string text = this.string_0 + "\\config\\鹊桥数据副.mdb";
		if (!File.Exists(text))
		{
			throw new Exception("目标数据库不存在,无法压缩");
		}
		try
		{
			if (this.oleDbConnection_0 != null)
			{
				this.oleDbConnection_0.Close();
				this.oleDbConnection_0.Dispose();
				this.oleDbConnection_0 = null;
			}
			string text2 = "alibrdgurl" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bak";
			text2 = text.Substring(0, text.LastIndexOf("\\") + 1) + text2;
			string destconnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + text2 + ";Jet OLEDB:Database Password=item[%]789";
			string sourceConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + text + ";Jet OLEDB:Database Password=item[%]789";
			new JetEngineClass().CompactDatabase(sourceConnection, destconnection);
			File.Copy(text2, text, true);
			File.Delete(text2);
		}
		catch
		{
		}
		finally
		{
			this.method_0();
		}
	}
	public bool method_3(EventGoodsItem eventGoodsItem, out string string_1)
	{
		bool result;
		try
		{
			string text = "INSERT INTO bridgeitemurl(eventId, itemId, sclkUrl1, sclkUrl2, picUrl) VALUES ('{eventId}','{itemId}', '{sclkUrl1}', '{sclkUrl2}', '{picUrl}');";
			new OleDbCommand(text.Replace("{eventId}", eventGoodsItem.event_id).Replace("{itemId}", eventGoodsItem.num_iid).Replace("{sclkUrl1}", eventGoodsItem.sclkUrl1).Replace("{sclkUrl2}", eventGoodsItem.sclkUrl2).Replace("{picUrl}", eventGoodsItem.pic_url), this.oleDbConnection_0).ExecuteNonQuery();
			string_1 = "";
			result = true;
		}
		catch (Exception ex)
		{
			string_1 = "出错啦！" + ex.ToString();
			result = false;
		}
		return result;
	}
	public ArrayList method_4(string string_1, string string_2, out string string_3)
	{
		string string_4 = string.Concat(new string[]
		{
			"select * from bridgeitemurl where eventId='",
			string_1,
			"' and  itemId='",
			string_2,
			"'"
		});
		return this.method_6(string_4, out string_3);
	}
	public ArrayList method_5(int int_0, out string string_1)
	{
		string string_2 = "select * from bridgeitemurl where biid=" + int_0;
		return this.method_6(string_2, out string_1);
	}
	public ArrayList method_6(string string_1, out string string_2)
	{
		ArrayList result;
		try
		{
			ArrayList arrayList = new ArrayList();
			OleDbDataReader oleDbDataReader = new OleDbCommand(string_1, this.oleDbConnection_0).ExecuteReader();
			while (oleDbDataReader.Read())
			{
				EventGoodsItem eventGoodsItem = new EventGoodsItem();
				eventGoodsItem.int_0 = int.Parse(oleDbDataReader["biid"].ToString());
				eventGoodsItem.event_id = oleDbDataReader["eventId"].ToString();
				eventGoodsItem.num_iid = oleDbDataReader["itemId"].ToString();
				eventGoodsItem.sclkUrl1 = oleDbDataReader["sclkUrl1"].ToString();
				eventGoodsItem.url.StartsWith("http://");
				eventGoodsItem.sclkUrl2 = oleDbDataReader["sclkUrl2"].ToString();
				eventGoodsItem.pic_url = oleDbDataReader["picUrl"].ToString();
				eventGoodsItem.url.StartsWith("http://");
				arrayList.Add(eventGoodsItem);
			}
			string_2 = "";
			oleDbDataReader.Close();
			result = arrayList;
		}
		catch (Exception ex)
		{
			string_2 = "出错啦：" + ex.ToString();
			result = new ArrayList();
		}
		return result;
	}
	public bool method_7(string string_1, out string string_2)
	{
		string string_3 = "delete from bridgeitemurl where eventId='" + string_1 + "'";
		return this.method_9(string_3, out string_2);
	}
	public bool method_8(string string_1, string string_2, out string string_3)
	{
		string string_4 = string.Concat(new string[]
		{
			"delete from bridgeitemurl where eventId='",
			string_1,
			"'and  itemId='",
			string_2,
			"'"
		});
		return this.method_9(string_4, out string_3);
	}
	public bool method_9(string string_1, out string string_2)
	{
		bool result;
		try
		{
			new OleDbCommand(string_1, this.oleDbConnection_0).ExecuteNonQuery();
			string_2 = "";
			result = true;
		}
		catch (Exception ex)
		{
			string_2 = "出错啦：" + ex.ToString();
			result = false;
		}
		return result;
	}
}
